home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / vtcl / doc / CrtPipelin.3 < prev    next >
Encoding:
Text File  |  1995-07-10  |  5.5 KB  |  122 lines

  1. '\"
  2. '\" Copyright (c) 1989-1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/CrtPipelin.3,v 1.7 93/04/09 11:53:47 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. '\"----------------------------------------------------------------------------
  24. '\"    @(#) CrtPipelin.3 26.1 93/10/22 SCOINC
  25. '\"
  26. '\"     Copyright (C) The Santa Cruz Operation, 1992-1993.
  27. '\"     This Module contains Proprietary Information of
  28. '\"    The Santa Cruz Operation, and should be treated as Confidential.
  29. '\"----------------------------------------------------------------------------
  30. .so ../man.macros
  31. .HS Tcl_CreatePipeline tclc
  32. .BS
  33. .SH NAME
  34. Tcl_CreatePipeline \- create one or more child processes, with I/O redirection
  35. .SH SYNOPSIS
  36. .nf
  37. \fB#include <tcl.h>\fR
  38. .sp
  39. int
  40. \fBTcl_CreatePipeline\fR(\fIinterp, argc, argv, pidArrayPtr, inPipePtr, outPipePtr, errFilePtr\fR)
  41. .SH ARGUMENTS
  42. .AS Tcl_Interp **pidArrayPtr
  43. .AP Tcl_Interp *interp in
  44. Interpreter to use for error reporting.
  45. .AP int argc in
  46. Number of strings in \fIargv\fR array.
  47. .AP char **argv in
  48. Array of strings describing command(s) and I/O redirection.
  49. .AP int **pidArrayPtr out
  50. The value at \fI*pidArrayPtr\fR is modified to hold a pointer to
  51. an array of process identifiers.  The array is dynamically
  52. allocated and must be freed by the caller.
  53. .AP int *inPipePtr out
  54. If this argument is NULL then standard input for the first command
  55. in the pipeline comes from the current standard input.
  56. If \fIinPipePtr\fR is not NULL then \fBTcl_CreatePipeline\fR will
  57. create a pipe, arrange for it to be used for standard input
  58. to the first command,
  59. and store a file id for writing to that pipe at \fI*inPipePtr\fR.
  60. If the command specified its own input using redirection, then
  61. no pipe is created and -1 is stored at \fI*inPipePtr\fR.
  62. .AP int *outPipePtr out
  63. If this argument is NULL then standard output for the last command
  64. in the pipeline goes to the current standard output.
  65. If \fIoutPipePtr\fR is not NULL then \fBTcl_CreatePipeline\fR will
  66. create a pipe, arrange for it to be used for standard output from
  67. the last command, and store a file id for reading from that
  68. pipe at \fI*outPipePtr\fR.
  69. If the command specified its own output using redirection then
  70. no pipe is created and -1 is stored at \fI*outPipePtr\fR.
  71. .AP int *errFilePtr out
  72. If this argument is NULL then error output for all the commands
  73. in the pipeline will go to the current standard error file.
  74. If \fIerrFilePtr\fR is not NULL, error output from all the commands
  75. in the pipeline will go to a temporary file created by
  76. \fBTcl_CreatePipeline\fR.
  77. A file id to read from that file will be stored at \fI*errFilePtr\fR.
  78. The file will already have been removed, so closing the file
  79. descriptor at \fI*errFilePtr\fR will cause the file to be flushed
  80. completely.
  81. .BE
  82.  
  83. .SH DESCRIPTION
  84. .PP
  85. \fBTcl_CreatePipeline\fR processes the \fIargv\fR array and sets
  86. up one or more child processes in a pipeline configuration.
  87. \fBTcl_CreatePipeline\fR handles pipes specified with ``|'',
  88. input redirection specified with ``<'' or ``<<'', and output
  89. redirection specified with ``>'';  see the documentation for
  90. the \fBexec\fR command for details on these specifications.
  91. The return value from \fBTcl_CreatePipeline\fR is a count of
  92. the number of child processes created;  the process identifiers
  93. for those processes are stored in a \fImalloc\fR-ed array and
  94. a pointer to that array is stored at \fI*pidArrayPtr\fR.
  95. It is the caller's responsibility to free the array when finished
  96. with it.
  97. .PP
  98. If the \fIinPipePtr\fR, \fIoutPipePtr\fR, and \fIerrFilePtr\fR
  99. arguments are NULL then the pipeline's standard input, standard
  100. output, and standard error are taken from the corresponding
  101. streams of the process.  Non-NULL values may be specified for
  102. these arguments to use pipes for standard input and standard
  103. output and a file for standard error.  \fBTcl_CreatePipeline\fR
  104. will create the requested pipes or file and return file identifiers
  105. that may be used to read or write them.  It is the caller's
  106. responsibility to close all of these files when they are no
  107. longer needed.  If \fIargv\fR specifies redirection for standard
  108. input or standard output, then pipes will not be created even
  109. if requested by the \fIinPipePtr\fR and \fIoutPipePtr\fR
  110. arguments.
  111. .PP
  112. If an error occurs in \fBTcl_CreatePipeline\fR (e.g. ``|'' or
  113. ``<'' was the last argument in \fIargv\fR, or it wasn't possible
  114. to fork off a child), then -1 is returned
  115. and \fIinterp->result\fR is set to an error message.
  116.  
  117. .SH "SEE ALSO"
  118. \fBTcl_DetachPids\fR, \fBTcl_ReapDetachedProcs\fR
  119.  
  120. .SH KEYWORDS
  121. background, child, detach, fork, process, status, wait
  122.